/*
 * @Author: 李无敌
 * @Date: 2025-07-25 13:57:38
 * @LastEditors: 李无敌
 * @LastEditTime: 2025-08-12 14:41:45
 * @FilePath: \nest-base\src\app.controller.ts
 */
import { Controller, Get, Res, Param } from '@nestjs/common';
import { FastifyReply } from 'fastify';
import { AppService } from './app.service';
import { join } from 'path';
import { existsSync } from 'fs';

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  // @Get()
  // getHello(): string {
  //   return this.appService.getHello();
  // }

  // @Get('uploads/:filename')
  // serveUploads(@Res() res: FastifyReply, @Param('filename') filename: string) {
  //   const filePath = join(process.cwd(), 'uploads', filename);
  //   if (existsSync(filePath)) {
  //     // 由于已经在main.ts中配置了静态文件服务，直接重定向
  //     return res.status(301).redirect(`/uploads/${filename}`);
  //   }
  //   return res.status(404).send({ message: '文件不存在' });
  // }
}
